#ifndef __LSM6DSL_H
#define __LSM6DSL_H

#include "stm32f10x.h"

#ifdef __cplusplus
extern "C" {
#endif
    
#define LSM6DSL_ACC_GYRO_ODR_XL_MASK                                0xF0
#define LSM6DSL_ACC_GYRO_ODR_G_MASK                                 0xF0
#define LSM6DSL_ACC_GYRO_FS_125_MASK                                0x02
#define LSM6DSL_ACC_GYRO_FS_G_MASK                                  0x0C
#define LSM6DSL_ACC_GYRO_FS_XL_MASK                                 0x0C

/************** Device Register  *******************/
#define LSM6DSL_FUNC_CFG_ACCESS                                     0X01
#define LSM6DSL_SENSOR_SYNC_TIME_FRAME                              0X04
#define LSM6DSL_SENSOR_SYNC_RES_RATIO                               0X05
#define LSM6DSL_FIFO_CTRL1                                          0X06
#define LSM6DSL_FIFO_CTRL2                                          0X07
#define LSM6DSL_FIFO_CTRL3                                          0X08
#define LSM6DSL_FIFO_CTRL4                                          0X09
#define LSM6DSL_FIFO_CTRL5                                          0X0A
#define LSM6DSL_DRDY_PULSE_CFG_G                                    0X0B
#define LSM6DSL_INT1_CTRL                                           0X0D
#define LSM6DSL_INT2_CTRL                                           0X0E
#define LSM6DSL_WHO_AM_I                                            0X0F
#define LSM6DSL_CTRL1_XL                                            0X10
#define LSM6DSL_CTRL2_G                                             0X11
#define LSM6DSL_CTRL3_C                                             0X12
#define LSM6DSL_CTRL4_C                                             0X13
#define LSM6DSL_CTRL5_C                                             0X14
#define LSM6DSL_CTRL6_G                                             0X15
#define LSM6DSL_CTRL7_G                                             0X16
#define LSM6DSL_CTRL8_XL                                            0X17
#define LSM6DSL_CTRL9_XL                                            0X18
#define LSM6DSL_CTRL10_C                                            0X19
#define LSM6DSL_MASTER_CONFIG                                       0X1A
#define LSM6DSL_WAKE_UP_SRC                                         0X1B
#define LSM6DSL_TAP_SRC                                             0X1C
#define LSM6DSL_D6D_SRC                                             0X1D
#define LSM6DSL_STATUS_REG                                          0X1E
#define LSM6DSL_OUT_TEMP_L                                          0X20
#define LSM6DSL_OUT_TEMP_H                                          0X21
#define LSM6DSL_OUTX_L_G                                            0X22
#define LSM6DSL_OUTX_H_G                                            0X23
#define LSM6DSL_OUTY_L_G                                            0X24
#define LSM6DSL_OUTY_H_G                                            0X25
#define LSM6DSL_OUTZ_L_G                                            0X26
#define LSM6DSL_OUTZ_H_G                                            0X27
#define LSM6DSL_OUTX_L_XL                                           0X28
#define LSM6DSL_OUTX_H_XL                                           0X29
#define LSM6DSL_OUTY_L_XL                                           0X2A
#define LSM6DSL_OUTY_H_XL                                           0X2B
#define LSM6DSL_OUTZ_L_XL                                           0X2C
#define LSM6DSL_OUTZ_H_XL                                           0X2D
#define LSM6DSL_SENSORHUB1_REG                                      0X2E
#define LSM6DSL_SENSORHUB2_REG                                      0X2F
#define LSM6DSL_SENSORHUB3_REG                                      0X30
#define LSM6DSL_SENSORHUB4_REG                                      0X31
#define LSM6DSL_SENSORHUB5_REG                                      0X32
#define LSM6DSL_SENSORHUB6_REG                                      0X33
#define LSM6DSL_SENSORHUB7_REG                                      0X34
#define LSM6DSL_SENSORHUB8_REG                                      0X35
#define LSM6DSL_SENSORHUB9_REG                                      0X36
#define LSM6DSL_SENSORHUB10_REG                                     0X37
#define LSM6DSL_SENSORHUB11_REG                                     0X38
#define LSM6DSL_SENSORHUB12_REG                                     0X39
#define LSM6DSL_FIFO_STATUS1                                        0X3A
#define LSM6DSL_FIFO_STATUS2                                        0X3B
#define LSM6DSL_FIFO_STATUS3                                        0X3C
#define LSM6DSL_FIFO_STATUS4                                        0X3D
#define LSM6DSL_FIFO_DATA_OUT_L                                     0X3E
#define LSM6DSL_FIFO_DATA_OUT_H                                     0X3F
#define LSM6DSL_TIMESTAMP0_REG                                      0X40
#define LSM6DSL_TIMESTAMP1_REG                                      0X41
#define LSM6DSL_TIMESTAMP2_REG                                      0X42
#define LSM6DSL_STEP_TIMESTAMP_L                                    0X49
#define LSM6DSL_STEP_TIMESTAMP_H                                    0X4A
#define LSM6DSL_STEP_COUNTER_L                                      0X4B
#define LSM6DSL_STEP_COUNTER_H                                      0X4C
#define LSM6DSL_SENSORHUB13_REG                                     0X4D
#define LSM6DSL_SENSORHUB14_REG                                     0X4E
#define LSM6DSL_SENSORHUB15_REG                                     0X4F
#define LSM6DSL_SENSORHUB16_REG                                     0X50
#define LSM6DSL_SENSORHUB17_REG                                     0X51
#define LSM6DSL_SENSORHUB18_REG                                     0X52
#define LSM6DSL_FUNC_SRC1                                           0X53
#define LSM6DSL_FUNC_SRC2                                           0X54
#define LSM6DSL_TAP_CFG1                                            0X58
#define LSM6DSL_TAP_THS_6D                                          0X59
#define LSM6DSL_INT_DUR2                                            0X5A
#define LSM6DSL_WAKE_UP_THS                                         0X5B
#define LSM6DSL_WAKE_UP_DUR                                         0X5C
#define LSM6DSL_FREE_FALL                                           0X5D
#define LSM6DSL_MD1_CFG                                             0X5E
#define LSM6DSL_MD2_CFG                                             0X5F

/* DataSheet 20页，由厂商出厂校准得到不同量程的分辨率 */
#define LSM6DSL_GYRO_SENSITIVITY_FOR_FS_125DPS   04.375  /**< Sensitivity value for 125 dps full scale [mdps/LSB] */
#define LSM6DSL_GYRO_SENSITIVITY_FOR_FS_245DPS   08.750  /**< Sensitivity value for 245 dps full scale [mdps/LSB] */
#define LSM6DSL_GYRO_SENSITIVITY_FOR_FS_500DPS   17.500  /**< Sensitivity value for 500 dps full scale [mdps/LSB] */
#define LSM6DSL_GYRO_SENSITIVITY_FOR_FS_1000DPS  35.000  /**< Sensitivity value for 1000 dps full scale [mdps/LSB] */
#define LSM6DSL_GYRO_SENSITIVITY_FOR_FS_2000DPS  70.000  /**< Sensitivity value for 2000 dps full scale [mdps/LSB] */

#define LSM6DSL_ACC_SENSITIVITY_FOR_FS_2G   0.061  /**< Sensitivity value for 2 g full scale [mg/LSB] */
#define LSM6DSL_ACC_SENSITIVITY_FOR_FS_4G   0.122  /**< Sensitivity value for 4 g full scale [mg/LSB] */
#define LSM6DSL_ACC_SENSITIVITY_FOR_FS_8G   0.244  /**< Sensitivity value for 8 g full scale [mg/LSB] */
#define LSM6DSL_ACC_SENSITIVITY_FOR_FS_16G  0.488  /**< Sensitivity value for 16 g full scale [mg/LSB] */

#ifdef __cplusplus
}
#endif

#endif
